﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UtilsLib.UtilsType
{
    public class DateTimeZone
    {
        private DateTime _utcDateTime;
        private TimeZoneInfo _timeZone;

        public DateTime UtcDateTime
        {
            get { return _utcDateTime; }
            private set { }
        }
        public TimeZoneInfo TimeZone
        {
            get { return _timeZone; }
            private set { }
        }

        public DateTimeZone(DateTime dateTime, TimeZoneInfo timeZone)
        {
            _utcDateTime = TimeZoneInfo.ConvertTimeToUtc(dateTime, timeZone);
            _timeZone = timeZone;
        }

        public DateTime GetLocalTime()
        {
            return TimeZoneInfo.ConvertTime(_utcDateTime, _timeZone);
        }

        public static DateTime GetLocalTime(DateTime dateTime, TimeZoneInfo timeZone)
        {
            return TimeZoneInfo.ConvertTime(dateTime, timeZone);
        }
    }
}
